/**
 * Created by zack on 2017/5/8.
 */
import Toast from 'react-native-root-toast'

const ToastMsg = {
	show: (msg, durationSet) => {
		let message = msg
		let time = 2000
		if (durationSet === 2000) {
			time = 2000
		} else if (durationSet === 3000) {
			time = 3000
		} else if (durationSet === 4000) {
			time = 4000
		} else if (durationSet === 5000) {
			time = 5000
		} else if (durationSet === 6000) {
			time = 6000
		} else if (durationSet === 7000) {
			time = 7000
		} else if (durationSet === 8000) {
			time = 8000
		} else if (durationSet === 9000) {
			time = 9000
		} else if (durationSet === 10000) {
			time = 10000
		} else {
			time = 2000
		}

		const messageParam = {
			duration: time,
			position: Toast.positions.CENTER,
			shadow: true,
			animation: true,
			hideOnPress: false,
			delay: 0,
		}

		Toast.show(message, messageParam);
	}
}

export default ToastMsg
